{% extends 'djangobb_forum/base.html' %}
{% load pagination_tags %}
{% load forum_extras %}
{% load i18n %}

{% block content %}
{% autopaginate results forum_settings.SEARCH_PAGE_SIZE %}
<div class="linkst">
	<div class="inbox">
		<p class="pagelink">{% paginate %}</p>
		<div class="clearer"></div>
	</div>
</div>
{% if results %}
<div id="vf" class="blocktable">
	<h2><span>{% trans "Search results" %}</span></h2>
	<div class="box">
		<div class="inbox">
			<table cellspacing="0">
			<thead>
				<tr>
					<th class="tcl" scope="col">{% trans "Topic" %}</th>
					<th class="tc2" scope="col">{% trans "Forum" %}</th>
					<th class="tc3" scope="col">{% trans "Replies" %}</th>
					<th class="tcr" scope="col">{% trans "Last post" %}</th>
				</tr>
			</thead>
			<tbody>
			{% for topic in results %}
				<tr {% if topic|has_unreads:user %}class="inew"{% endif %} {% if topic.closed %}class="iclosed"{% endif %}>
					<td class="tcl">
						<div class="intd">
							<div class="icon"><div class="nosize"><!-- --></div></div>
							<div class="tclcon">
								{% if topic|has_unreads:user %}
									<strong>{% link topic %} <span class="byuser">{% trans "by" %} {{ topic.user }}</span></strong>
								{% else %}
									{% link topic %} <span class="byuser">{% trans "by" %} {{ topic.user }}</span>
								{% endif %}
							</div>
						</div>
					</td>
					<td class="tc2">{% link topic.forum %}</td>
					<td class="tc3">{{ topic.reply_count }}</td>
					<td class="tcr"><a href="{{ topic.get_absolute_url }}">{% forum_time topic.updated %}</a> <span class="byuser">{% trans "by" %} {{ topic.last_post.user.username }}</span></td>
				</tr>
			{% endfor %}
			</tbody>
			</table>
		</div>
	</div>
</div>

{% else %}
<div id="msg" class="block">
	<h2><span>{% trans "Info" %}</span></h2>
	<div class="box">
		<div class="inbox">
		<p>{% trans "Your search returned no hits." %}</p>
		<p><a href="javascript: history.go(-1)">{% trans "Go back" %}</a></p>
		</div>
	</div>
</div>
{% endif %}
<div class="linksb">
	<div class="inbox">
		<p class="pagelink">{% paginate %}</p>
		<div class="clearer"></div>
	</div>
</div>
{% endblock %}

{% block controls %}
				<dl id="searchlinks" class="conl">
					<dt><strong>{% trans "Search links" %}</strong></dt>
					<dd><a href="{% url djangobb:search %}?action=show_24h">{% trans "Show recent posts" %}</a></dd>
					<dd><a href="{% url djangobb:search %}?action=show_unanswered">{% trans "Show unanswered posts" %}</a></dd>
					{% if user.is_authenticated %}
					<dd><a href="{% url djangobb:search %}?action=show_subscriptions">{% trans "Show your subscribed topics" %}</a></dd>
					<dd><a href="{% url djangobb:search %}?action=show_user&amp;user_id={{ request.user.id }}">{% trans "Show your posts" %}</a></dd>
					{% endif %}
				</dl>
{% endblock %}
